import request from '@/config/axios'
import type { Dayjs } from 'dayjs'

/** 路线信息 */
export interface RobotRoute {
  id: number // 编号
  robotId?: number // 机器人ID
  robotCode?: string // 机器人编号
  robotName?: string // 机器人名称
  routeName?: string // 路线名称
  iconUrl: string // 路线海报图
  description: string // 路线描述
  sort?: number // 排序
  status?: number // 状态
}

// 路线 API
export const RobotRouteApi = {
  // 查询路线分页
  getRobotRoutePage: async (params: any) => {
    return await request.get({ url: `/school/robot-route/page`, params })
  },

  // 查询精简版路线
  getSimpleRobotRouteList: async () => {
    return await request.get({ url: `/school/robot-route/simple-list` })
  },

  // 查询路线详情
  getRobotRoute: async (id: number) => {
    return await request.get({ url: `/school/robot-route/get?id=` + id })
  },

  // 新增路线
  createRobotRoute: async (data: RobotRoute) => {
    return await request.post({ url: `/school/robot-route/create`, data })
  },

  // 修改路线
  updateRobotRoute: async (data: RobotRoute) => {
    return await request.put({ url: `/school/robot-route/update`, data })
  },

  // 删除路线
  deleteRobotRoute: async (id: number) => {
    return await request.delete({ url: `/school/robot-route/delete?id=` + id })
  },

  /** 批量删除路线 */
  deleteRobotRouteList: async (ids: number[]) => {
    return await request.delete({ url: `/school/robot-route/delete-list?ids=${ids.join(',')}` })
  },

  // 导出路线 Excel
  exportRobotRoute: async (params) => {
    return await request.download({ url: `/school/robot-route/export-excel`, params })
  }
}
